package com.yifeng.service.impl;

import com.yifeng.dao.UserMapper;
import com.yifeng.po.User;
import com.yifeng.service.IUserService;
import com.yifeng.util.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends BaseServiceImpl<User> implements IUserService {

    @Autowired
    private UserMapper UserMapper;

    public void leave(Long id) {
        UserMapper.leave(id);
    }

    public User findByUsername(String username) {
        return UserMapper.loadByUsername(username);
    }

    public void saveRole(User User) {
        User.setPassword(Md5Util.encrypt(User.getPassword()));
        UserMapper.save(User);
    }
}
